<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Person(name, sex) {
            this.aname = name;
            this.asex = sex;
        }
        var person = new Person('ArimaMisaki', 'fale');

        //constructor用于指明某对象原型的构造函数
        console.log(Person.prototype.constructor);
        console.log(person.__proto__.constructor);
        console.log(person.constructor);

        //用法：手动指回构造函数
        function Star(uname,age){
            this.uname = uname;
            this.age = age;
        }

        //原型对象被覆盖了，没有用.的方式来添加
        Star.prototype = {
            //需要用constructor指回原对象
            constructor:Star,
            sing:function(){
                console.log('我会唱歌');
            },
            movie:function(){
                console.log('我会演电影');
            }
        }
        
        //声明对象
        var ldh = new Star('刘德华',18);
        console.log(ldh.__proto__);
    </script>
</body>
</html>